<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
class GoodsController extends Controller
{
    //

    public function col(Request $request)
    {
        $id = $request -> id;
         $res = DB::table('goods') -> where("gid", $id) -> update(["col" => 1]);
         if($res)
        {
            return 1;
        }else
        {
            return 0;
        }
    }
    public function detail($gid)
    {
        $data = DB::table('goods')-> where('gid',$gid) -> first();
        $data_color = DB::table('color') -> get();
        $data_memory = DB::table('memory') -> get();
        // dd($data_color);
        // dd($data);
        // c pid = cname
        // $color = DB::tabl('color') -> get();
        // dd($color);
        return view('home.detail.index',['info' => '商品详情','data' => $data,'data_color' => $data_color,'data_memory' => $data_memory]);
    }

}
